home *** CD-ROM | disk | FTP | other *** search
/ Freelog 112 / FreelogNo112-NovembreDecembre2012.iso / Jeu / deadlyrace / deadlyrace_setup.exe / {app} / Data / Scripts / game_interface.lua < prev    next >
Encoding:
Text File  |  2010-05-07  |  34.2 KB  |  1,293 lines

  1. local script = globalObject;
  2.  
  3. local interface;
  4. local commandMap = {};
  5.  
  6. local game_started = false;
  7. local active_side = "";
  8. local ingame = false;
  9. local damaged  = false;
  10. local damaged_time = 0;
  11. local game_finish = false;
  12. --local pArrow = CreateArrow("arrow.rdf", 2);
  13. local points = 0;
  14.  
  15. --zil_130             azot_flame --zil_130_
  16. --uaz_469             galogen_lights --uaz
  17. --gaz_z110             force_wall --gaz_3110_main
  18. --audi_tt             tornado
  19. --bmw_i745             lifting --bmw
  20. --Volkswaken_Touareg    outforce --volswaken_toureg     
  21. local medal = 0;
  22.  
  23. local cars_abilities = {};
  24. cars_abilities["zil_130"]        = "azot_flame";
  25. cars_abilities["uaz_469"]    = "galogen_lights";
  26. cars_abilities["gaz_z110"]    = "force_wall";   
  27. cars_abilities["audi_tt"]        = "tornado";
  28. cars_abilities["bmw_i745"]     = "lifting"; 
  29. cars_abilities["volk_t"]         = "outforce"; 
  30.  
  31. local cars_abilities_hollow = {};
  32. cars_abilities_hollow["zil_130"]    = "hollow_azot_flame";
  33. cars_abilities_hollow["uaz_469"]    = "hollow_galogen_lights";
  34. cars_abilities_hollow["gaz_z110"]    = "hollow_force_wall"; 
  35. cars_abilities_hollow["audi_tt"]    = "hollow_tornado";
  36. cars_abilities_hollow["bmw_i745"]    = "hollow_lifting";
  37. cars_abilities_hollow["volk_t"]        = "hollow_outforce"; 
  38.  
  39. local leader = "leader_frame"; 
  40.  
  41. local players = {}; 
  42. players            = SetPlayersPanel();
  43.  
  44. local dt            = 0;
  45. local ddt            = 0;
  46. local blink_time     = 0;
  47. local blink_dt         = 0;
  48. local blink_ddt        = 0;
  49. local blink_abilitiy     = 0;
  50. local bBlink        = false;
  51.  
  52. local round = {}; 
  53.  
  54. round[1] = "round_1"; 
  55. round[2] = "round_2"; 
  56. round[3] = "round_3"; 
  57. round[4] = "round_4"; 
  58. round[5] = "round_5";
  59. round[6] = "round_6";
  60. round[7] = "round_7";
  61. round[8] = "round_8";
  62. round[9] = "round_9";
  63. round[10] = "round_10";
  64.  
  65. local round_time = {}; 
  66.  
  67. round_time[1] = "round_1_time";
  68. round_time[2] = "round_2_time";
  69. round_time[3] = "round_3_time";
  70. round_time[4] = "round_4_time";
  71. round_time[5] = "round_5_time";
  72. round_time[6] = "round_6_time";
  73. round_time[7] = "round_7_time";
  74. round_time[8] = "round_8_time";
  75. round_time[9] = "round_9_time";
  76. round_time[10] = "round_10_time";
  77.  
  78.  
  79. local function ExecuteCommands()
  80.     while(SetNextCommand(script))
  81.     do
  82.         local command = GetCurrentCommand(script);
  83.         if (commandMap[command])
  84.         then
  85. --            SaveLog(command);
  86.             commandMap[command]();
  87.             
  88.         end
  89.     end
  90. end
  91. local medaltime = 0;
  92. local function ShowMedal(n)
  93.     if (not game_finish)
  94.     then
  95.         SetWindowVisible(interface, "gold", false);        
  96.         SetWindowVisible(interface, "silver", false);        
  97.         SetWindowVisible(interface, "bronze", false);        
  98.         medaltime = 0;
  99.         medal = tonumber(n);
  100.         SetMedal(medal);
  101.         if (n == 3)
  102.         then
  103.             SetWindowVisible(interface, "gold", true);        
  104.         elseif (n == 2)
  105.         then
  106.             SetWindowVisible(interface, "silver", true);
  107.         elseif (n == 1)
  108.         then
  109.             SetWindowVisible(interface, "bronze", true);
  110.         end
  111.         
  112.         local m = GetMedalType(GetCurrentRace());
  113.         if (medal > m)
  114.         then
  115.             SetMedalType(GetCurrentRace(), medal);
  116.         end
  117.         if (not IsDeathRace())
  118.         then
  119.         
  120.             SendCommandByName("game_interface", "show_message", "finish!");
  121.         end
  122.     end
  123. end
  124.  
  125.  
  126. local function ShowMedalCommand()
  127.     local n = tonumber(GetCurrentParams(script));
  128.     ShowMedal(n);
  129.     UpdateInterfaceBuffers(interface);
  130. end
  131.  
  132. local function DrawAbilities()
  133. --~     local n, max_ab    = ActivateAbilities();
  134. --~     local acar            = GetActiveCar();
  135. --~     
  136. --~     local height = (46 / max_ab) * n;
  137. --~     SetWindowSize(interface, "bar_ab_f", 6, -height);
  138. --~     
  139. --~     if((n == 0) and (not bBlink))
  140. --~     then
  141. --~         SetWindowVisible(interface, cars_abilities_hollow[acar], true);
  142. --~         SetWindowVisible(interface, cars_abilities[acar], false);
  143. --~     elseif(not bBlink)
  144. --~     then
  145. --~         SetWindowVisible(interface, cars_abilities_hollow[acar], false);
  146. --~         SetWindowVisible(interface, cars_abilities[acar], true);
  147. --~     end
  148. --~     
  149. --~     UpdateInterfaceBuffers(interface);
  150. end
  151.  
  152. local function Blink()
  153. --~     if(bBlink)
  154. --~     then        
  155. --~         blink_dt = blink_dt + GetDeltaTime();
  156. --~         if(blink_dt < blink_time)
  157. --~         then
  158. --~             if(0 == blink_abilitiy)
  159. --~             then
  160. --~                 blink_dt = 0.0;
  161. --~                 bBlink = false;
  162. --~                 DrawAbilities();
  163. --~                 return;
  164. --~             end
  165. --~             
  166. --~             local acar = GetActiveCar();
  167. --~             
  168. --~             blink_ddt = blink_ddt + GetDeltaTime();
  169. --~             
  170. --~             if(blink_ddt > 0.4)
  171. --~             then
  172. --~                 blink_ddt = 0.0;
  173. --~             elseif(blink_ddt > 0.2)
  174. --~             then
  175. --~                 SetWindowVisible(interface, cars_abilities[acar], true);
  176. --~                 SetWindowVisible(interface, cars_abilities_hollow[acar], false);
  177. --~             else
  178. --~                 SetWindowVisible(interface, cars_abilities_hollow[acar], true);
  179. --~                 SetWindowVisible(interface, cars_abilities[acar], false);
  180. --~             end
  181. --~         else
  182. --~             blink_dt = 0.0;
  183. --~             bBlink = false;
  184. --~             DrawAbilities();
  185. --~         end
  186. --~     end
  187. end
  188.  
  189. local function DrawEnemiesPoints()
  190.     local size;
  191.     local map = {}; 
  192.     size, map = GetAIPositions();
  193.     
  194.     local f = 1;
  195.     local j = 1;
  196. --    SaveLog(size);
  197.     for i = 1, size, 3 
  198.     do 
  199.         local wnd = "enemy_point"..j;
  200. --        if(true == map[i + 2])
  201. --        then
  202. --            wnd = "friend_point"..f;
  203. --            f = f + 1;
  204. --        else
  205.             j = j + 1;
  206. --        end
  207. --        SaveLog(wnd);
  208.         SetWindowPosition(interface, wnd,  map[i], map[i+1]);
  209.         SetWindowVisible(interface, wnd, true);
  210.     end 
  211.     UpdateInterfaceBuffers(interface);
  212. end
  213.  
  214. local function DrawSummonPanel()
  215.     local mana = GetPlayerMana();
  216.     local height = (46 / 100) * mana;
  217.     SetWindowSize(interface, "bar_summon_f", 6, -height);
  218.     UpdateInterfaceBuffers(interface);
  219. end
  220.  
  221.  
  222. local lastscore = 0;
  223. local function DrawPlayersPanel()
  224.  
  225.  
  226.     SetWindowVisible(interface, "1st", false);
  227.     SetWindowVisible(interface, "2nd", false);
  228.     SetWindowVisible(interface, "3rd", false);
  229.     SetWindowVisible(interface, "4th", false);
  230.     SetWindowVisible(interface, "5th", false);
  231.     SetWindowVisible(interface, "6th", false);
  232.  
  233.     if (not IsDeathRace())
  234.     then
  235.         players = SetPlayersPanel(); 
  236.         
  237.     --    SetPlayerName("viper");
  238.         local cur_car = GetPlayerName(); 
  239.         for i = 1, 6 do
  240.         --    SaveLog("Player "..players[i]);
  241.             if (players[i] == "10") 
  242.             then
  243.                     if (i == 1)
  244.                     then
  245.                         SetWindowVisible(interface, "1st", true);
  246.                     elseif (i == 2)
  247.                     then
  248.                         SetWindowVisible(interface, "2nd", true);
  249.                     elseif (i == 3)
  250.                     then
  251.                         SetWindowVisible(interface, "3rd", true);
  252.                     elseif (i == 4)
  253.                     then
  254.                         SetWindowVisible(interface, "4th", true);
  255.                     elseif (i == 5)
  256.                     then
  257.                         SetWindowVisible(interface, "5th", true);
  258.                     elseif (i == 6)
  259.                     then
  260.                         SetWindowVisible(interface, "6th", true);
  261.                     end
  262.             end
  263.         end 
  264.         
  265.         local num = points;
  266.         SetText(interface, "low_points_text", string.format("%0.3d", num));
  267.         lastscore = num;
  268.         
  269.     else
  270.         local num = points;
  271.         SetText(interface, "up_points_text", string.format("%0.3d", num));
  272.         if (num >= GetMedalPoints(medal + 1) and lastscore < GetMedalPoints(medal + 1))
  273.         then
  274.             medal = medal + 1;
  275.             ShowMedal(medal);
  276.             if (medal > 3)
  277.             then
  278.                 medal = 3;
  279.             end
  280.         end
  281.         lastscore = num;
  282.     end
  283.     
  284.     UpdateInterfaceBuffers(interface);
  285. end
  286.  
  287. local function InitPointsWindows()
  288.  
  289.     if (not IsDeathRace())
  290.     then
  291.         SetText(interface, "up_points_text", "");
  292.         SetWindowVisible(interface, "up_points_txt", false);
  293.         
  294.         SetText(interface, "low_points_text", "000");
  295.         SetWindowVisible(interface, "low_points_wnd", true);
  296.         SetWindowVisible(interface, "low_points_txt", true);
  297.         
  298.         SetText(interface, "mid_points_text", "");
  299.         SetWindowVisible(interface, "mid_points_wnd", false);
  300.         SetText(interface, "mid_points_txt", "");
  301.         
  302.         SetWindowVisible(interface, "time_wnd", false);
  303.       SetText(interface, "time", "");
  304.         
  305.         SetWindowVisible(interface, "armor_wnd", true);
  306.         SetWindowVisible(interface, "life1", true);
  307.         SetWindowVisible(interface, "life2", true);
  308.         SetWindowVisible(interface, "life3", true);
  309.         SetWindowVisible(interface, "life4", true);
  310.         SetWindowVisible(interface, "life5", true);
  311.         SetWindowVisible(interface, "life6", true);
  312.         SetWindowVisible(interface, "life7", true);
  313.         SetWindowVisible(interface, "life8", true);
  314. --        SetWindowVisible(interface, "life9", true);
  315. --        SetWindowVisible(interface, "life10", true);
  316.         
  317.     else
  318.         SetWindowVisible(interface, "time_wnd", true);
  319.         SetText(interface, "time", "");
  320.     
  321.         SetText(interface, "mid_points_text", "000");
  322.         SetWindowVisible(interface, "mid_points_wnd", true);
  323.         SetTextString(interface, "mid_points_txt", "bronze1");
  324.     
  325.         SetText(interface, "low_points_text", "");
  326.         SetWindowVisible(interface, "low_points_wnd", false);
  327.         SetWindowVisible(interface, "low_points_txt", false);
  328.         
  329.         SetText(interface, "up_points_text", "000");
  330.         SetWindowVisible(interface, "up_points_txt", true);
  331.         
  332.         SetWindowVisible(interface, "armor_wnd", false);
  333.         SetWindowVisible(interface, "life1", false);
  334.         SetWindowVisible(interface, "life2", false);
  335.         SetWindowVisible(interface, "life3", false);
  336.         SetWindowVisible(interface, "life4", false);
  337.         SetWindowVisible(interface, "life5", false);
  338.         SetWindowVisible(interface, "life6", false);
  339.         SetWindowVisible(interface, "life7", false);
  340.         SetWindowVisible(interface, "life8", false);
  341. --        SetWindowVisible(interface, "life9", false);
  342. --        SetWindowVisible(interface, "life10", false);
  343.     end
  344. end
  345.  
  346. local function DrawRoundsInfo()
  347.     
  348.     local zero = "0"; 
  349.     local lap_time = {};
  350.     local count, lap_time = UpdateRoundsTime();
  351.     
  352.     local str = {}; 
  353.     local vis = {};
  354.     
  355.     local j = 1;
  356.     for i = 1, count, 4 do
  357.         str[j] = string.format("%0.2d:%0.2d:%0.2d ", lap_time[i], lap_time[i+1], lap_time[i+2]);
  358.         vis[j] = lap_time[i+3];
  359.         j = j + 1
  360.     end
  361.     
  362.     
  363.     for i = 1, 10 do 
  364.         SetWindowVisible(interface, round[i], vis[i]); 
  365.         if(vis[i])
  366.         then
  367.             SetText(interface, round_time[i], str[i]);
  368.         end;
  369.         SetWindowVisible(interface, round_time[i], vis[i])
  370.     end 
  371. end
  372.  
  373.  
  374.  
  375. local function DrawRoundsUpheader()
  376.     if (IsDeathRace())
  377.     then
  378.             local round_curr     = GetCurrentRound();
  379.             SetText(interface, "round_curr2", round_curr); 
  380.             SetText(interface, "round_curr", ""); 
  381.             SetText(interface, "rounds", ""); 
  382.             SetText(interface, "slash", ""); 
  383.     else
  384.         local rounds     = GetRoundsNumber(); 
  385.         local round_curr     = GetCurrentRound();
  386.         if(round_curr <= rounds)
  387.         then
  388.             SetText(interface, "round_curr2", ""); 
  389.             SetText(interface, "round_curr", round_curr); 
  390.             SetText(interface, "rounds", rounds); 
  391.             SetTextString(interface, "slash", "laps"); 
  392.         end
  393.     end
  394. end 
  395.  
  396. local function DrawTime()
  397.     if (IsDeathRace())
  398.     then
  399.         local     minutes, secs, msecs = GetTime(); 
  400.         local     str = string.format("%0.2d:%0.2d:%0.2d ", minutes, secs, msecs);
  401.         SetText(interface, "time", str); 
  402.     end
  403. end
  404.  
  405. local bSign         = false;
  406. local bSignVisible    = true;
  407. local function StopSign()
  408. --~     local pangle, spangle = GetPlayerSplineAngle();
  409. --~     local angle = pangle - spangle;
  410. --~     while(angle > 6.283)
  411. --~     do
  412. --~         angle = angle - 6.283;
  413. --~     end
  414. --~     while(angle < 0)
  415. --~     do
  416. --~         angle = angle + 6.283;
  417. --~     end
  418.  
  419. --~     if((angle > 1.570) and (angle < 4.713))
  420. --~     then
  421. --~         bSign = true;
  422. --~     else
  423. --~         if(bSignVisible)
  424. --~         then
  425. --~             SetWindowVisible(interface, "stopsign", false);
  426. --~         end
  427. --~         bSign = false;
  428. --~     end
  429.     
  430.     if(IsPlayerMovingBackwards())
  431.     then
  432.         bSign = true;
  433.     else
  434.         if(bSignVisible)
  435.         then
  436.             SetWindowVisible(interface, "stopsign", false);
  437.         end
  438.         bSign = false;
  439.     end
  440.     
  441. --    SaveLog("updateinterface3_5");
  442.  
  443.     if(bSign)
  444.     then
  445.         dt = dt + GetDeltaTime();
  446.         if(dt > 0.5)
  447.         then
  448.             if(bSignVisible)
  449.             then
  450.                 SetWindowVisible(interface, "stopsign", false);
  451.                 bSignVisible = false;
  452.                 dt = 0;
  453.             else
  454.                 SetWindowVisible(interface, "stopsign", true);
  455.                 bSignVisible = true;
  456.                 dt = 0;
  457.             end
  458.         end
  459.     end
  460. end
  461.  
  462. local function DrawEnergy()
  463.     local arm, maxarm = GetPlayerArmor();
  464.     local percent = tonumber(arm) / tonumber(maxarm) * 8.0;
  465.     if (arm > 0 and percent < 1)
  466.     then
  467.         percent = 1;
  468.     end
  469.     for i = 1,8    do
  470.         local sss = string.format("life%d", i);
  471.         SetWindowVisible(interface, sss, false);
  472.         
  473.     end
  474.     
  475.     for i = 1,percent    do
  476.         local sss = string.format("life%d", i);
  477.         SetWindowVisible(interface, sss, true);
  478.         
  479.     end
  480. end
  481. local function DrawNitro()
  482.     local arm = GetPlayerNitro();
  483.     local percent = tonumber(arm) / 100.0 * 8.0;
  484.     if (arm > 0 and percent < 1)
  485.     then
  486.         percent = 1;
  487.     end
  488.     for i = 1,8    do
  489.         local sss = string.format("nitro%d", i);
  490.         SetWindowVisible(interface, sss, false);
  491.         
  492.     end
  493.     for i = 1,percent    do
  494.         local sss = string.format("nitro%d", i);
  495.         SetWindowVisible(interface, sss, true);
  496.         
  497.     end
  498. end
  499. local function DrawHealth()
  500.     if(bDrawHealth)
  501.     then
  502.         SetWindowVisible(interface, "helth_bar", true);
  503.         SetWindowPosition(interface, "helth_bar", GetHelthBarCoord(pCar));
  504.     end
  505. end
  506.  
  507. local HelthBar = 
  508. {
  509.     fDt        = 0.0;
  510.     pCar0        = nil;
  511.     bDraw0    = false;
  512.     pCar1        = nil;
  513.     bDraw1    = false;
  514.     pCar2        = nil;
  515.     bDraw2    = false;
  516.     pCar3        = nil;
  517.     bDraw3    = false;
  518.     pCar4        = nil;
  519.     bDraw4    = false;
  520.     pCar5        = nil;
  521.     bDraw5    = false;
  522.     Draw        = nil;
  523.     Reset        = nil;
  524. };
  525.  
  526. HelthBar.Draw = function ()
  527.     if(HelthBar.bDraw0)
  528.     then
  529.         local x, y, width = GetHelthBarCoord(HelthBar.pCar0);
  530.         if(width < 0.0)
  531.         then
  532.             width = 0.0;
  533.         end
  534.         
  535.         SetWindowPosition(interface, "health0", x, y);
  536.         SetWindowPosition(interface, "health_f0", x + 2, y - 8);
  537.         
  538.         SetWindowSize(interface, "health_f0", width, 6);
  539.         
  540.         SetWindowVisible(interface, "health0", true);
  541.         SetWindowVisible(interface, "health_f0", true);
  542.         
  543. --~         HelthBar.fDt = HelthBar.fDt +GetDeltaTime();
  544. --~         if(HelthBar.fDt >= 5.0)
  545. --~         then
  546. --~             HelthBar.fDt    = 0.0;
  547. --~             HelthBar.bDraw    = false;
  548. --~             
  549. --~             SetWindowVisible(interface, "health", false);
  550. --~             SetWindowVisible(interface, "health_f", false);
  551. --~         end
  552.     end
  553.     if(HelthBar.bDraw1)
  554.     then
  555.         local x, y, width = GetHelthBarCoord(HelthBar.pCar1);
  556.         if(width < 0.0)
  557.         then
  558.             width = 0.0;
  559.         end
  560.         
  561.         SetWindowPosition(interface, "health1", x, y);
  562.         SetWindowPosition(interface, "health_f1", x + 2, y - 8);
  563.         
  564.         SetWindowSize(interface, "health_f1", width, 6);
  565.         
  566.         SetWindowVisible(interface, "health1", true);
  567.         SetWindowVisible(interface, "health_f1", true);
  568.         
  569. --~         HelthBar.fDt = HelthBar.fDt +GetDeltaTime();
  570. --~         if(HelthBar.fDt >= 5.0)
  571. --~         then
  572. --~             HelthBar.fDt    = 0.0;
  573. --~             HelthBar.bDraw    = false;
  574. --~             
  575. --~             SetWindowVisible(interface, "health", false);
  576. --~             SetWindowVisible(interface, "health_f", false);
  577. --~         end
  578.     end
  579.     if(HelthBar.bDraw2)
  580.     then
  581.         local x, y, width = GetHelthBarCoord(HelthBar.pCar2);
  582.         if(width < 0.0)
  583.         then
  584.             width = 0.0;
  585.         end
  586.         
  587.         SetWindowPosition(interface, "health2", x, y);
  588.         SetWindowPosition(interface, "health_f2", x + 2, y - 8);
  589.         
  590.         SetWindowSize(interface, "health_f2", width, 6);
  591.         
  592.         SetWindowVisible(interface, "health2", true);
  593.         SetWindowVisible(interface, "health_f2", true);
  594.         
  595. --~         HelthBar.fDt = HelthBar.fDt +GetDeltaTime();
  596. --~         if(HelthBar.fDt >= 5.0)
  597. --~         then
  598. --~             HelthBar.fDt    = 0.0;
  599. --~             HelthBar.bDraw    = false;
  600. --~             
  601. --~             SetWindowVisible(interface, "health", false);
  602. --~             SetWindowVisible(interface, "health_f", false);
  603. --~         end
  604.     end
  605.     if(HelthBar.bDraw3)
  606.     then
  607.         local x, y, width = GetHelthBarCoord(HelthBar.pCar3);
  608.         if(width < 0.0)
  609.         then
  610.             width = 0.0;
  611.         end
  612.         
  613.         SetWindowPosition(interface, "health3", x, y);
  614.         SetWindowPosition(interface, "health_f3", x + 2, y - 8);
  615.         
  616.         SetWindowSize(interface, "health_f3", width, 6);
  617.         
  618.         SetWindowVisible(interface, "health3", true);
  619.         SetWindowVisible(interface, "health_f3", true);
  620.         
  621. --~         HelthBar.fDt = HelthBar.fDt +GetDeltaTime();
  622. --~         if(HelthBar.fDt >= 5.0)
  623. --~         then
  624. --~             HelthBar.fDt    = 0.0;
  625. --~             HelthBar.bDraw    = false;
  626. --~             
  627. --~             SetWindowVisible(interface, "health", false);
  628. --~             SetWindowVisible(interface, "health_f", false);
  629. --~         end
  630.     end
  631.     if(HelthBar.bDraw4)
  632.     then
  633.         local x, y, width = GetHelthBarCoord(HelthBar.pCar4);
  634.         if(width < 0.0)
  635.         then
  636.             width = 0.0;
  637.         end
  638.         
  639.         SetWindowPosition(interface, "health4", x, y);
  640.         SetWindowPosition(interface, "health_f4", x + 2, y - 8);
  641.         
  642.         SetWindowSize(interface, "health_f4", width, 6);
  643.         
  644.         SetWindowVisible(interface, "health4", true);
  645.         SetWindowVisible(interface, "health_f4", true);
  646.         
  647. --~         HelthBar.fDt = HelthBar.fDt +GetDeltaTime();
  648. --~         if(HelthBar.fDt >= 5.0)
  649. --~         then
  650. --~             HelthBar.fDt    = 0.0;
  651. --~             HelthBar.bDraw    = false;
  652. --~             
  653. --~             SetWindowVisible(interface, "health", false);
  654. --~             SetWindowVisible(interface, "health_f", false);
  655. --~         end
  656.     end
  657.     if(HelthBar.bDraw5)
  658.     then
  659.         local x, y, width = GetHelthBarCoord(HelthBar.pCar5);
  660.         if(width < 0.0)
  661.         then
  662.             width = 0.0;
  663.         end
  664.         
  665.         SetWindowPosition(interface, "health5", x, y);
  666.         SetWindowPosition(interface, "health_f5", x + 2, y - 8);
  667.         
  668.         SetWindowSize(interface, "health_f5", width, 6);
  669.         
  670.         SetWindowVisible(interface, "health5", true);
  671.         SetWindowVisible(interface, "health_f5", true);
  672.         
  673. --~         HelthBar.fDt = HelthBar.fDt +GetDeltaTime();
  674. --~         if(HelthBar.fDt >= 5.0)
  675. --~         then
  676. --~             HelthBar.fDt    = 0.0;
  677. --~             HelthBar.bDraw    = false;
  678. --~             
  679. --~             SetWindowVisible(interface, "health", false);
  680. --~             SetWindowVisible(interface, "health_f", false);
  681. --~         end
  682.     end
  683. end
  684. HelthBar.Delete = function ()
  685.         HelthBar.pCar0 = nil;
  686.         HelthBar.pCar1 = nil;
  687.         HelthBar.pCar2 = nil;
  688.         HelthBar.pCar3 = nil;
  689.         HelthBar.pCar4 = nil;
  690.         HelthBar.pCar5 = nil;
  691.         HelthBar.bDraw0    = false;
  692.         HelthBar.bDraw1    = false;
  693.         HelthBar.bDraw2    = false;
  694.         HelthBar.bDraw3    = false;
  695.         HelthBar.bDraw4    = false;
  696.         HelthBar.bDraw5    = false;
  697. end
  698.  
  699. HelthBar.Reset = function ()
  700.     local pCar, _num = GetCurrentParams(script);
  701.     
  702.     local num = tonumber(_num);
  703.     if (num == 0)
  704.     then
  705.         HelthBar.pCar0 = StringToPointer(pCar);
  706.         HelthBar.bDraw0    = true;
  707.     elseif (num == 1)
  708.     then
  709.         HelthBar.pCar1 = StringToPointer(pCar);
  710.         HelthBar.bDraw1    = true;
  711.     elseif (num == 2)
  712.     then
  713.         HelthBar.pCar2 = StringToPointer(pCar);
  714.         HelthBar.bDraw2    = true;
  715.     elseif (num == 3)
  716.     then
  717.         HelthBar.pCar3 = StringToPointer(pCar);
  718.         HelthBar.bDraw3    = true;
  719.     elseif (num == 4)
  720.     then
  721.         HelthBar.pCar4 = StringToPointer(pCar);
  722.         HelthBar.bDraw4    = true;
  723.     elseif (num == 5)
  724.     then
  725.         HelthBar.pCar5 = StringToPointer(pCar);
  726.         HelthBar.bDraw5    = true;
  727.     end
  728.     HelthBar.fDt    = 0.0;
  729. end
  730.  
  731. local resultstime = -1;
  732. local res1 = 0;
  733. local res2 = 0;
  734. local res3 = 0;
  735.  
  736. local function ShowResults(n)
  737.     if (n == 0)
  738.     then
  739.             SetWindowVisible(interface, "results_back", false);
  740.             SetWindowVisible(interface, "results_line1", false);
  741.             SetWindowVisible(interface, "results_line2", false);
  742.             SetWindowVisible(interface, "results_header", false);
  743.             SetText(interface, "race_type", "");
  744.             SetText(interface, "epoints", "");
  745.             SetText(interface, "medal", "");
  746.             SetText(interface, "totalmoney", "");
  747.             SetText(interface, "epoints_credits", "");
  748.             SetText(interface, "medal_credits", "");
  749.             SetText(interface, "ttl", "");
  750.             resultstime = -1;
  751.             res1 = 0;
  752.             res2 = 0;
  753.             res3 = 0;
  754.             medal = 0;
  755.     elseif (n == 1)
  756.     then
  757.             SetText(interface, "mid_points_text", "");
  758.             SetWindowVisible(interface, "mid_points_wnd", false);
  759.             SetText(interface, "mid_points_txt", "");
  760.             SetWindowVisible(interface, "results_back", true);
  761.             SetWindowVisible(interface, "results_line1", true);
  762.             SetWindowVisible(interface, "results_line2", true);
  763.             SetWindowVisible(interface, "results_header", true);
  764.             if (IsDeathRace())
  765.             then
  766.                 SetTextString(interface, "race_type", "deathrace");
  767.             else
  768.                 SetTextString(interface, "race_type", "circuitrace");
  769.             end
  770.             SetText(interface, "epoints", "");
  771.             SetText(interface, "medal", "");
  772.             SetText(interface, "totalmoney", "");
  773.             SetText(interface, "epoints_credits", "");
  774.             SetText(interface, "medal_credits", "");
  775.             SetText(interface, "ttl", "");
  776.             resultstime = 0;
  777.             res1 = 0;
  778.             res2 = 0;
  779.             res3 = 0;
  780. --            medal = 0;
  781.     end
  782. end
  783.  
  784. local TIMETOSHOW = 1.5;
  785.  
  786. local function SetWindowSizeAndPos(wnd, init_width, init_height, init_y, percent)
  787. --    percent = math.max(1, percent);
  788.     SetWindowSize(interface, wnd, init_width * percent, init_height * percent);
  789.     SetWindowPosition(interface, wnd, 512 - init_width * percent / 2.0, init_y - init_height * percent / 2.0);
  790. end
  791.  
  792. local KillMessage = 
  793. {
  794.     Initialize    = nil;
  795.     ShowMsg    = nil;
  796.     Update    = nil;
  797.     Release    = nil;
  798.     dt        = 0.0;
  799.     wnd        = "";
  800.     bShow    = false;
  801.     type = 1;
  802. };
  803.  
  804. KillMessage.Initialize = function ()
  805.     SetWindowVisible(interface, "corpse1", false);
  806.     SetWindowVisible(interface, "corpse2", false);
  807.     SetWindowVisible(interface, "corpse3", false);
  808.     
  809.     KillMessage.dt         = 0.0;
  810.     KillMessage.bShow     = false;
  811.     KillMessage.wnd     = "";
  812.     KillMessage.type = 1;
  813. end
  814.  
  815. KillMessage.ShowMsg = function ()
  816.     if(KillMessage.bShow)
  817.     then
  818.             SetWindowVisible(interface, KillMessage.wnd, false);
  819.             KillMessage.type = math.min(3, KillMessage.type + 1);
  820.     end
  821.     KillMessage.dt        = 0.0;
  822.     KillMessage.bShow    = true;
  823.     
  824.     KillMessage.wnd = GetCurrentParams(script)..KillMessage.type;
  825. --    SaveLog(GameMessage.wnd);
  826.     
  827.     if (not game_finish)
  828.     then
  829.             TIMETOSHOW = 1.0;
  830.             SetWindowVisible(interface, KillMessage.wnd, true);
  831.             if (IsDeathRace() and KillMessage.type < 2)
  832.             then
  833.                 SetWindowVisible(interface, KillMessage.wnd, false);
  834.             end
  835.     end    
  836.     
  837. end
  838.  
  839. KillMessage.Update = function ()
  840.     if(KillMessage.dt < TIMETOSHOW)
  841.     then
  842.         KillMessage.dt = KillMessage.dt + GetDeltaTime();
  843.         if (KillMessage.type == 1)
  844.         then
  845.             SetWindowSizeAndPos(KillMessage.wnd, 290, 194, 200, (100 - (KillMessage.dt / TIMETOSHOW) * (KillMessage.dt / TIMETOSHOW) * (KillMessage.dt / TIMETOSHOW) * 100.0) * 0.015);
  846.         elseif (KillMessage.type == 2)
  847.         then
  848.             SetWindowSizeAndPos(KillMessage.wnd, 284, 212, 200, (100 - (KillMessage.dt / TIMETOSHOW) * (KillMessage.dt / TIMETOSHOW) * (KillMessage.dt / TIMETOSHOW) * 100.0) * 0.015);
  849.         elseif (KillMessage.type == 3)
  850.         then
  851.             SetWindowSizeAndPos(KillMessage.wnd, 473, 206, 200, (100 - (KillMessage.dt / TIMETOSHOW) * (KillMessage.dt / TIMETOSHOW) * (KillMessage.dt / TIMETOSHOW) * 100.0) * 0.015);
  852.         end
  853.     elseif(KillMessage.bShow)
  854.     then
  855.         SetWindowVisible(interface, KillMessage.wnd, false);
  856.         KillMessage.bShow = false;
  857.         KillMessage.type = 1;
  858.     end
  859. end
  860.  
  861.  
  862.  
  863. local GameMessage = 
  864. {
  865.     Initialize    = nil;
  866.     ShowMsg    = nil;
  867.     Update    = nil;
  868.     Release    = nil;
  869.     dt        = 0.0;
  870.     wnd        = "";
  871.     bShow    = false;
  872.     
  873.     cur_x = 0;
  874. };
  875.  
  876. GameMessage.Initialize = function ()
  877.     SetWindowVisible(interface, "uskorenie!", false);
  878.     SetWindowVisible(interface, "zamedlenie!", false);
  879.     SetWindowVisible(interface, "remont!", false);
  880.     SetWindowVisible(interface, "zavulon!", false);
  881.     SetWindowVisible(interface, "gesser!", false);
  882.     SetWindowVisible(interface, "uron_x2!", false);
  883.     SetWindowVisible(interface, "sposobnost+1!", false);
  884.     SetWindowVisible(interface, "sposobnost-1!", false);
  885.     SetWindowVisible(interface, "start!", false);
  886.     SetWindowVisible(interface, "finish!", false);
  887.     SetWindowVisible(interface, "krug_proiden!", false);
  888.     SetWindowVisible(interface, "proigrish!_1", false);
  889.     SetWindowVisible(interface, "proigrish!_2", false);
  890.     SetWindowVisible(interface, "ready!", false);
  891.     SetWindowVisible(interface, "steady!", false);
  892.     SetWindowVisible(interface, "lost!", false);
  893.     
  894.     GameMessage.dt         = 0.0;
  895.     GameMessage.bShow     = false;
  896.     GameMessage.wnd     = "";
  897. end
  898.  
  899. GameMessage.ShowMsg = function ()
  900.     if(GameMessage.bShow)
  901.     then
  902.             SetWindowVisible(interface, GameMessage.wnd, false);
  903.     end
  904.     GameMessage.dt        = 0.0;
  905.     GameMessage.bShow    = true;
  906.     
  907.     GameMessage.wnd = GetCurrentParams(script);
  908. --    SaveLog(GameMessage.wnd);
  909.     
  910.     if (not game_finish)
  911.     then
  912.         if ("nil!" ~= GameMessage.wnd)
  913.         then
  914.             PlaySpecialSound("text");
  915.         end
  916.         if("proigrish!" == GameMessage.wnd)
  917.         then
  918.             SetWindowVisible(interface, "proigrish!_1", true);
  919.             SetWindowVisible(interface, "proigrish!_2", true);
  920.             game_finish = true;
  921.             SetLevelStarted(false);
  922.             TIMETOSHOW = 1.5;
  923.         elseif ("finish!" == GameMessage.wnd)
  924.         then
  925.             game_finish = true;
  926.             SetLevelStarted(false);
  927.             SetWindowVisible(interface, GameMessage.wnd, true);
  928.             TIMETOSHOW = 2.5;
  929.       elseif ("lost!" == GameMessage.wnd)
  930.         then
  931.             game_finish = true;
  932.             SetLevelStarted(false);
  933.             SetWindowVisible(interface, GameMessage.wnd, true);
  934.             TIMETOSHOW = 2.5;
  935.         elseif ("posledniy_krug!" == GameMessage.wnd)
  936.         then
  937.             TIMETOSHOW = 1.5;
  938.             PlaySpecialSound("start_a");
  939.             SetWindowVisible(interface, GameMessage.wnd, true);
  940.         else
  941.             TIMETOSHOW = 1.5;
  942.             SetWindowVisible(interface, GameMessage.wnd, true);
  943.         end
  944.         
  945.         if (GameMessage.wnd ~= "nil!" and GameMessage.wnd ~= "start!" and GameMessage.wnd ~= "ready!" and GameMessage.wnd ~= "steady!")
  946.         then
  947.             SetWindowSizeAndPos(GameMessage.wnd, 363,190, 350, 0);
  948.         end
  949.     end
  950.     
  951.     
  952.     if("start!" == GameMessage.wnd)
  953.     then
  954.         game_started = true;
  955.         SendCommandByName("jeep", "game_started", "");
  956.         SetLevelStarted(true);
  957.     end
  958.     
  959.     UpdateInterfaceBuffers(interface);
  960.     
  961. end
  962.  
  963. GameMessage.Update = function ()
  964.     if(GameMessage.dt < TIMETOSHOW)
  965.     then
  966.         GameMessage.dt = GameMessage.dt + GetDeltaTime();
  967.  
  968.         if (GameMessage.wnd == "finish!")
  969.         then
  970.             SetWindowSizeAndPos(GameMessage.wnd, 363,190, 350, (0 + (GameMessage.dt / TIMETOSHOW) * (GameMessage.dt / TIMETOSHOW) * (GameMessage.dt / TIMETOSHOW) * 100.0) * 0.015);
  971.         elseif (GameMessage.wnd == "lost!")
  972.         then
  973.             SetWindowSizeAndPos(GameMessage.wnd, 285,159, 350, (0 + (GameMessage.dt / TIMETOSHOW) * (GameMessage.dt / TIMETOSHOW) * (GameMessage.dt / TIMETOSHOW) * 100.0) * 0.015);
  974.         elseif (GameMessage.wnd == "krug_proiden!")
  975.         then
  976.             SetWindowSizeAndPos(GameMessage.wnd, 432,94, 350, (0 + (GameMessage.dt / TIMETOSHOW) * (GameMessage.dt / TIMETOSHOW) * (GameMessage.dt / TIMETOSHOW) * 100.0) * 0.015);
  977.         elseif (GameMessage.wnd == "posledniy_krug!")
  978.         then
  979.             SetWindowSizeAndPos(GameMessage.wnd, 432,104, 350, (0 + (GameMessage.dt / TIMETOSHOW) * (GameMessage.dt / TIMETOSHOW) * (GameMessage.dt / TIMETOSHOW) * 100.0) * 0.015);
  980. --~         elseif (GameMessage.wnd == "start!")
  981. --~         then
  982. --~             SetWindowSizeAndPos(GameMessage.wnd, 271,94, 350, (0 + (GameMessage.dt / TIMETOSHOW) * (GameMessage.dt / TIMETOSHOW) * (GameMessage.dt / TIMETOSHOW) * 100.0) * 0.015);
  983. --~         elseif (GameMessage.wnd == "ready!")
  984. --~         then
  985. --~             SetWindowSizeAndPos(GameMessage.wnd, 271,94, 350, (0 + (GameMessage.dt / TIMETOSHOW) * (GameMessage.dt / TIMETOSHOW) * (GameMessage.dt / TIMETOSHOW) * 100.0) * 0.015);
  986. --~         elseif (GameMessage.wnd == "steady!")
  987. --~         then
  988. --~             SetWindowSizeAndPos(GameMessage.wnd, 271,94, 350, (0 + (GameMessage.dt / TIMETOSHOW) * (GameMessage.dt / TIMETOSHOW) * (GameMessage.dt / TIMETOSHOW) * 100.0) * 0.015);
  989. --~         elseif (GameMessage.wnd == "nil!")
  990. --~         then
  991. --~             SetWindowSizeAndPos(GameMessage.wnd, 271,94, 350, (0 + (GameMessage.dt / TIMETOSHOW) * (GameMessage.dt / TIMETOSHOW) * (GameMessage.dt / TIMETOSHOW) * 100.0) * 0.015);
  992.         end
  993.  
  994.  
  995.     elseif(GameMessage.bShow)
  996.     then
  997.         if("finish!" == GameMessage.wnd)
  998.         then
  999.             SetWindowVisible(interface, GameMessage.wnd, false);
  1000.             ShowResults(1);
  1001. --            SendCommandByName("main", "player_finish", "");
  1002.         elseif("lost!" == GameMessage.wnd)
  1003.         then
  1004.             SetWindowVisible(interface, GameMessage.wnd, false);
  1005.             SendCommandByName("main", "player_exit", "");
  1006.         else
  1007.             SetWindowVisible(interface, GameMessage.wnd, false);
  1008.         end
  1009.         GameMessage.bShow = false;
  1010.     end
  1011. end
  1012.  
  1013.  
  1014. local function InitMedals()
  1015.         SetWindowVisible(interface, "gold", false);
  1016.         SetWindowVisible(interface, "silver", false);
  1017.         SetWindowVisible(interface, "bronze", false);
  1018. --        SetText(interface, "pointsformedal", "");
  1019. end
  1020.  
  1021.  
  1022. local function ShowMedalText()
  1023.     if (medal < 3)
  1024.     then
  1025.         local sss = "";
  1026.         if (medal + 1 == 1)
  1027.         then
  1028.             sss = "bronze1";
  1029.         elseif (medal + 1 == 2)
  1030.         then
  1031.             sss = "silver1";
  1032.         elseif (medal + 1 == 3)
  1033.         then
  1034.             sss = "gold1";
  1035.         end    
  1036.     SetTextString(interface, "mid_points_txt", sss);
  1037.     SetText(interface, "mid_points_text", string.format("%0.3d", GetMedalPoints(medal + 1)));
  1038. --        SetText(interface, "pointsformedal", string.format("EARN %d POINTS FOR %s MEDAL", GetMedalPoints(medal + 1), sss));
  1039. --    else
  1040. --        SetText(interface, "pointsformedal", "");
  1041.     end
  1042. end
  1043.  
  1044. local function UpdateMedals()
  1045.     if (medaltime < 1.5)
  1046.     then
  1047.         medaltime = medaltime + GetDeltaTime();
  1048.         if (medaltime >= 1.5)
  1049.         then
  1050.             InitMedals();
  1051.         end
  1052.     end
  1053. end
  1054.  
  1055.  
  1056.  
  1057. local function AddObject()
  1058. --    SaveLog("add_object");
  1059.     local obj = GetCurrentParams(script);
  1060.     interface = StringToPointer(obj);
  1061.     DrawAbilities(); 
  1062.     DrawPlayersPanel(); 
  1063.     DrawRoundsInfo(); 
  1064.     DrawRoundsUpheader(); 
  1065.     DrawTime();
  1066.     GameMessage.Initialize();
  1067.     KillMessage.Initialize();
  1068.         HelthBar.Delete();
  1069.  
  1070. --    SaveLog("initialized");
  1071.     
  1072.     game_started = false;
  1073.     dt            = 0;
  1074.     blink_time     = 0;
  1075.     blink_dt         = 0;
  1076.     blink_ddt        = 0;
  1077.     blink_abilitiy    = 0;
  1078.     bBlink        = false;
  1079. --    GetPlayerSplineAngle(true);
  1080.  
  1081.     SetWindowVisible(interface, "stopsign", false);
  1082. --    SetWindowVisible(interface, GetActiveCar().."_", true);
  1083.     
  1084.         SetWindowVisible(interface, "enemy_point1", false);
  1085.         SetWindowVisible(interface, "enemy_point2", false);
  1086.         SetWindowVisible(interface, "enemy_point3", false);
  1087.         SetWindowVisible(interface, "enemy_point4", false);
  1088.         SetWindowVisible(interface, "enemy_point5", false);
  1089.         SetWindowVisible(interface, "enemy_point6", false);
  1090.     
  1091.  
  1092.     SetPlayerMana(0);
  1093.     DrawSummonPanel();    
  1094.     local acar = GetActiveCar();
  1095.     if((acar == "audi_tt") or (acar == "bmw_i745") or (acar == "volk_t"))
  1096.     then
  1097.         SetWindowVisible(interface, "zavulon", true);
  1098.         active_side = "dark";
  1099.     else
  1100.         SetWindowVisible(interface, "gesser", true);
  1101.         active_side = "light";
  1102.     end
  1103.     
  1104.     SetText(interface, "time_curr", "TIME:");
  1105.     SetText(interface, "time_best", "BEST:");
  1106.     
  1107. --    SaveLog("interface_updated");
  1108.     ingame = true;
  1109.     damaged  = false;
  1110.     damaged_time = 0;
  1111.     game_finish = false;
  1112.     SendCommandByName("game_interface", "show_message", "nil!");
  1113.     InitPointsWindows();    
  1114.     InitMedals();
  1115.     ShowResults(0);
  1116.     lastscore = 0;
  1117.     points = 0;
  1118.     SetMedal(0);
  1119.     UpdateInterfaceBuffers(interface);
  1120. end
  1121.  
  1122. local function DeleteObject()
  1123. --~     SetWindowVisible(interface, cars_abilities[GetActiveCar()], false);
  1124. --~     SetWindowVisible(interface, cars_abilities_hollow[GetActiveCar()], false);
  1125. --~     SetWindowVisible(interface, GetActiveCar().."_", false);
  1126.     HelthBar.Delete();
  1127. --    SetWindowVisible(interface, "zavulon", false);
  1128. --    SetWindowVisible(interface, "gesser", false);
  1129.     
  1130.     Release(interface);
  1131.     interface = nil;
  1132.     
  1133.     StopScript(script);
  1134.     ingame = false;
  1135. --    Update();
  1136. end
  1137.  
  1138. local function ReleaseAll()
  1139. --~     SetWindowVisible(interface, cars_abilities[GetActiveCar()], false);
  1140. --~     SetWindowVisible(interface, cars_abilities_hollow[GetActiveCar()], false);
  1141. --~     SetWindowVisible(interface, GetActiveCar().."_", false);
  1142.     
  1143.     Release(interface);
  1144.     interface = nil;
  1145. end
  1146.  
  1147. local function AddPoints()
  1148.     local num = tonumber(GetCurrentParams(script));
  1149.     points = points + num * KillMessage.type;
  1150. end
  1151.  
  1152. commandMap["release_all"]         = ReleaseAll;
  1153. commandMap["add_object"]         = AddObject;
  1154. commandMap["delete_object"]     = DeleteObject;
  1155. commandMap["redraw_abilities"]     = DrawAbilities;
  1156. commandMap["blink_abilitiy"]        = function () DrawAbilities(); blink_time, blink_abilitiy = GetCurrentParams(script); blink_time = tonumber(blink_time); blink_abilitiy = tonumber(blink_abilitiy); bBlink = true; end;
  1157. commandMap["show_health"]        = HelthBar.Reset;
  1158. commandMap["show_message"]    = GameMessage.ShowMsg;
  1159. commandMap["add_points"]    = AddPoints;
  1160. commandMap["kill_message"]    = KillMessage.ShowMsg;
  1161. commandMap["show_medal"]    = ShowMedalCommand;
  1162.  
  1163. while(true)
  1164. do
  1165.     ExecuteCommands();
  1166.     if (ingame)
  1167.     then
  1168.  
  1169.             UpdateGameInterface(interface);        
  1170.         UpdateInterface(interface);
  1171.     --    SaveLog("updateinterface2");
  1172.         local x, y = GetWindowPosition(interface, "arrow");
  1173.         --DrawArrow(pArrow, 920, 665);
  1174. --        DrawArrow(pArrow, x, y);
  1175.         DrawEnemiesPoints(); 
  1176.         DrawRoundsUpheader();
  1177.         DrawRoundsInfo();
  1178.         if (not IsDeathRace())
  1179.         then
  1180.             DrawEnergy();
  1181.         else
  1182.             if (not game_finish)
  1183.             then
  1184.     
  1185.                 ShowMedalText();    
  1186.             end
  1187.         end
  1188.         DrawNitro();
  1189.         UpdateMedals();
  1190.         if (game_finish)
  1191.         then
  1192.             if (resultstime >= 0)
  1193.             then
  1194.                 SetText(interface, "mid_points_txt", "");
  1195.             SetText(interface, "mid_points_text", "");
  1196.             resultstime = resultstime  + GetDeltaTime();
  1197.                 if (resultstime >= 2 and res1 == 0)
  1198.                 then
  1199.                     local sss = string.format("%d earned points", points);
  1200.                     SetText(interface, "epoints", sss);
  1201.                     SetText(interface, "epoints_credits", string.format("= %d dollars", points * 10));
  1202.                     res1 = 1;
  1203.                 elseif (resultstime >= 4 and res2 == 0)
  1204.                 then
  1205.                     local sss = "gold";
  1206.                     local nn = tonumber(medal);
  1207.                     if (nn == 3)
  1208.                     then
  1209.                         sss = "gold";
  1210.                     elseif (nn == 2)
  1211.                     then
  1212.                         sss = "silver";
  1213.                     elseif (nn == 1)
  1214.                     then
  1215.                         sss = "bronze";
  1216.                     end
  1217.                     SetTextString(interface, "medal", sss);
  1218.                     SetText(interface, "medal_credits", string.format("= %d dollars", nn * 250));
  1219.                     res2 = 1;
  1220.                 elseif (resultstime >= 6 and res3 == 0)
  1221.                 then
  1222.                     SetTextString(interface, "totalmoney", "totalmoney");
  1223.                     SetText(interface, "ttl", (GetMoney() + points * 10 + tonumber(GetMedalType(GetCurrentRace())) * 250).." DOLLARS");
  1224.                     res3 = 1;
  1225.                 elseif (resultstime >= 9)
  1226.                 then
  1227.                     SendCommandByName("main", "player_finish", "");
  1228.                     SetMoney(GetMoney() + points * 10 + tonumber(GetMedalType(GetCurrentRace())) * 250);
  1229.                     resultstime = -1;
  1230.                 end
  1231.             end
  1232.         end
  1233.     --    SaveLog("updateinterface3");
  1234.         
  1235.         ddt = ddt + GetDeltaTime();
  1236.         local dddt;
  1237.         if (active_side == "dark")
  1238.         then
  1239.             dddt = 0.2 / 1.2;
  1240.         else
  1241.             dddt = 0.2 / 1.6;
  1242.         end
  1243.         if(ddt >= dddt and game_started)
  1244.         then
  1245.             local mana = GetPlayerMana();
  1246.             if(mana < 100)
  1247.             then
  1248.                 SetPlayerMana((mana + 1));
  1249.             end
  1250.             
  1251.             DrawSummonPanel();
  1252.             DrawPlayersPanel();
  1253.             ddt = 0.0;
  1254.             if (GetPlayerDamage() < 75)
  1255.             then
  1256. --                SetWindowVisible(interface, GetActiveCar().."_", true);
  1257.             end
  1258.         end
  1259.         
  1260.     --    SaveLog("updateinterface3_1");
  1261.         HelthBar.Draw();
  1262.         GameMessage.Update();
  1263.         KillMessage.Update();
  1264.     --    SaveLog("updateinterface3_2");
  1265.         
  1266.         StopSign();
  1267.     --    SaveLog("updateinterface3_3");
  1268.         Blink();
  1269.     --    SaveLog("updateinterface3_4");
  1270.         DrawTime();
  1271.     --    SaveLog("updateinterface4");
  1272.         
  1273.         if (GetPlayerDamage() >= 75)
  1274.         then
  1275.             if (damaged_time > 2 and damaged == true)
  1276.             then
  1277.                 damaged_time = 0;
  1278.                 damaged = false;
  1279. --                SetWindowVisible(interface, GetActiveCar().."_", false);
  1280.             end
  1281.             if (damaged_time > 0.5 and damaged == false)
  1282.             then
  1283.                 damaged_time = 0;
  1284.                 damaged = true;
  1285.     --            SetWindowVisible(interface, GetActiveCar().."_", true);
  1286.                 PlaySpecialSound("sos");
  1287.             end
  1288.             damaged_time = damaged_time + GetDeltaTime();
  1289.         end
  1290.     end
  1291.     Update();
  1292. end
  1293.